package xin.xinny.module.service.impl;

import xin.xinny.common.datasource.DataSourceContextHolder;
import xin.xinny.common.datasource.DataSourceType;
import xin.xinny.module.entity.User;
import xin.xinny.module.mapper.UserMapper;
import xin.xinny.module.service.IUserService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lemon
 * @since 2017-09-05
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {
    public void insertAB(User user){
        DataSourceContextHolder.setDbType(DataSourceType.dataSource_1);
        insert(user);
        DataSourceContextHolder.setDbType(DataSourceType.dataSource_2);
        insert(user);
    }
}
